package com.clusterswisdom.horn.api.ioc.api;

import org.dom4j.Element;

public class RequestParam {

	private String name;
	
	private ParamType type;
	
	private boolean required;
	
	private String mapping;
	
	private String defaultValue;
	
	private String struct;
	
	private String note;
	
	private String method;
	
	public RequestParam(Element element) {
		name = element.attributeValue("name");
		type = ParamType.findByName(element.attributeValue("type"));
		required = "true".equalsIgnoreCase(element.attributeValue("required"));
		mapping = element.attributeValue("mapping");
		defaultValue = element.attributeValue("default");
		struct = element.attributeValue("struct");
		note = element.attributeValue("note");
	}

	public String getName() {
		return name;
	}
	
	public ParamType getType() {
		return type;
	}

	public boolean isRequired() {
		return required;
	}

	public String getMapping() {
		return mapping;
	}

	public String getDefaultValue() {
		return defaultValue;
	}

	public String getStruct() {
		return struct;
	}
	
	public String getNote() {
		return note;
	}

	public void setMethod(String method) {
		this.method = method;
	}

	public String getMethod() {
		return method;
	}
}
